package com.sunday.common.validation.custom;

import com.sunday.common.core.enums.annotation.ContainsEnum;
import com.sunday.common.core.gson.GsonUtils;
import com.sunday.common.core.remoting.base.auth.BaseDTO;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.PositiveOrZero;
import jakarta.validation.constraints.Size;
import lombok.Data;

@Data
public class SavePermissionReqDTO extends BaseDTO {

    /**
     * 名称
     */
    @NotBlank
    @Size(min = 1, max = 50)
    private String name;

    /**
     * 路径
     */
    @NotBlank
    @Size(min = 1, max = 300)
    private String url;

    /**
     * 权限类别: 	             10. 后台权限(web 访问数据) 	             20. 路由权限(route permissions) 	             21. 页面权限(fine grit permissions) 30. 接口权限(api 能力权限)
     */
    @NotNull
    @ContainsEnum(enumType = PermissionEnums.CategoryEnum.class, message = "233333333")
    private Integer category;

    /**
     * 父级ID
     */
    @NotNull
    @PositiveOrZero
    private Long parentId;


    @Override
    public String toString() {
        return GsonUtils.DEFAULT.toJson(this);
    }

}
